import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Login from '../views/Login.vue'

Vue.use(VueRouter)

const DeviceMgr = () => import('../views/manager/DeviceMgr')
const MonitorMgr = () => import('../views/manager/MonitorMgr')
const MediaMgr = () => import('../views/manager/MediaManager')
const UpgradeMgr = () => import('../views/manager/UpgradeManager')
const BroadCaseMgr = () => import('../views/manager/BroadcastManager')
const StatisticsMgr = () => import('../views/manager/StatisticsManager')
const PlatformMgr = () => import('../views/manager/PlatformManager')
const SystemMgr = () => import('../views/manager/SystemManager')

const DeviceInfo = () => import('../views/manager/device/DeviceInfo')
const DeviceGIS = () => import('../views/manager/device/DeviceGis')
const DeviceWhite = () => import('../views/manager/device/DeviceWhite')
const DevicePlay = () => import('../views/manager/device/DevicePlay')
const DeviceBroad = () => import('../views/manager/device/DeviceBroad')

const MonitorRealtime = () => import('../views/manager/monitor/RealTime')
const MonitorPlayback = () => import('../views/manager/monitor/Playback')
const VideoUpload = () => import('../views/manager/monitor/VideoUpload')

const SubMediaMgr = () => import('../views/manager/media/MediaMgr')
const RealPlay = () => import('../views/manager/media/RealTimePlay')
const EffectEva = () => import('../views/manager/media/EffectEvaluation')

const routes = [
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/',
    name: 'Home',
    component: Home,
    children: [
      {
        path: '',
        redirect: 'device'
      }, {
        //设备管理
        path: 'device',
        component: DeviceMgr,
        children: [
          {
            path: '',
            redirect: 'info'
          }, {
            path: 'info',
            component: DeviceInfo
          }, {
            path: 'gis',
            component: DeviceGIS
          }, {
            path: 'white',
            component: DeviceWhite
          }, {
            path: 'play',
            component: DevicePlay
          }, {
            path: 'broad',
            component: DeviceBroad
          }
        ]
      }, {
        path: 'monitor',
        component: MonitorMgr,
        children: [
          {
            path: '',
            redirect: 'realtime'
          }, {
            path: 'realtime',
            component: MonitorRealtime
          }, {
            path: 'playback',
            component: MonitorPlayback
          }, {
            path: 'video-upload',
            component: VideoUpload
          }
        ]
      }, {
        path: 'media',
        component: MediaMgr,
        children: [
          {
            path: '',
            redirect: 'mgr'
          }, {
            path: 'mgr',
            component: SubMediaMgr
          }, {
            path: 'real',
            component: RealPlay
          }, {
            path: 'effect',
            component: EffectEva
          }
        ]
      }, {
        path: 'upgrade',
        component: UpgradeMgr
      }, {
        path: 'broadcast',
        component: BroadCaseMgr
      }, {
        path: 'statistics',
        component: StatisticsMgr
      }, {
        path: 'platform',
        component: PlatformMgr
      }, {
        path: 'system',
        component: SystemMgr
      }
    ]
  }
]

const router = new VueRouter({
  routes,
  mode: 'history'
})

export default router
